﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infected_Defense_Squad
{
    class Menus : IDS.Soldier
    {
        public Menus(string name, string position, string priority, int stress, int paycheck, int lvl, int health) :
            base(name, position, priority, stress, paycheck, lvl, health) { }
        public static int mainResponse, gameResponse;
        private static string[] names = { "Joe", "Jack", "John", "Jharl", "Katlyn",
                             "Kirk", "Lee", "Tyler", "Amy", "Lily", "Emily",
                             "Luke", "Cortus", "Gorden", "Lois", "Hannah", "Bill",
                             "Johnny", "Rock", "Eric", "Malcome", "Trayquan", "Victor", 
                             "Rob", "Robby", "Robert", "Crystal", "Churk"};
        public static bool mainMenuIsRunning, gameMainIsRunning, gameManageSoldiers;
        private const int NUM_SOLDIERS = 5;
        public static IDS.Soldier[] soldiers;
        public static void MainMenu()
        {
            
            #region  Initialize the soldiers
            soldiers = new IDS.Soldier[NUM_SOLDIERS];
            Random randGen = new Random();
            for (int i = 0; i < NUM_SOLDIERS; i++)
            {
                int r = randGen.Next(1, 27);
                soldiers[i] = new IDS.Soldier(names[r], "Stand By", "(None)", 20, 50, 0, 1);
            }
            #endregion 

            mainMenuIsRunning = true;

            while(mainMenuIsRunning)
            {
                Console.ForegroundColor = ConsoleColor.White;
                Console.Clear();
                Console.WriteLine(" Infected Defense Squad");
                Console.WriteLine();
                Console.WriteLine(" 1. New Game");
                Console.WriteLine(" 2. Load Game");
                Console.WriteLine(" 3. Options");
                Console.WriteLine(" 4. Credits");
                Console.WriteLine(" 5. Quit");

                mainResponse = Convert.ToInt32(Console.ReadLine());
                
                switch(mainResponse)
                {
                    case 1:
                        mainMenuIsRunning = false;
                        gameMainIsRunning = true;
                        GameMain();
                        break;
                    default:
                        break;
                }
            }
        }
        public static int day = 1;
        public static bool autoPay = false;
        public static void GameMain()
        {
            //do
            while(gameMainIsRunning)
            {
                Console.Clear();
                Console.WriteLine(" I.D.S.");
                Console.WriteLine(" Day: " + day);
                Console.WriteLine();
                Console.WriteLine(" 1. Manage Soliders");
                gameResponse = Convert.ToInt32(Console.ReadLine());
                
                switch (gameResponse)
                {
                    case 1:
                        //The user chooses to manage the soldiers
                        Console.Clear();
                        Console.WriteLine(" I.D.S.");
                        Console.WriteLine(" >Manage Soliders");
                        Console.WriteLine();
                        Console.WriteLine(" 1. List Soliders' Stats");
                        Console.WriteLine(" 2. Change Soldiers' Positions");
                        Console.WriteLine(" 3. Pay Squad Manually");
                        Console.WriteLine(" 4. Pay Squad Automaticly");
                        int minResponse = Convert.ToInt32(Console.ReadLine());
                        switch (minResponse)
                        {
                            case 1:
                                for (int i = 0; i < NUM_SOLDIERS; i++)
                                {
                                    Console.WriteLine(soldiers[i].toString());
                                }
                                Console.WriteLine("Press Enter to return to menu");
                                Console.ReadLine();
                                break;

                        }
                        break;
                    default:
                        //The user chooses to exit
                        gameMainIsRunning = false;
                        break;
                }
            }
        }
    }
}